Mapping between linear luminance values and luma codes

ABSTRACT

To enable better encoding of the currently starting to appear high dynamic range images for use in full high dynamic range technical systems (containing an HDR display, and e.g. in an HDR grading application), we invented a method of constructing a code allocation function for allocating pixel colors having pixel luminances to codes encoding such pixel luminances, in which the step of determining the code allocation function to be applied to at least one color coordinate of the pixel to obtain a code value, comprises constructing that function out of at least two partial functions, and similar methods at a receiving side, and apparatuses, and signals for communicating between the two sites. This method allows—in line with applicant&#39;s technical approach that HDR images should actually be communicated as a spectrum of differently regraded different dynamic range images of the same scene, e.g. a master HDR image and another image of the same HDR scene encoded with a different dynamic range and peak brightness than the master HDR image, and one of these images should be communicated to receivers together with luminance mapping functions co-communicated in metadata allowing the calculation at the receiving side of the non-transmitted different dynamic range image—a better application of dynamically per scene optimizable luminance mapping functions.

CROSS-REFERENCE TO PRIOR APPLICATIONS

This application is a Continuation of application Ser. No. 14/903,294,filed Jan. 7, 2016, which is the U.S. National Phase application under35 U.S.C. § 371 of International Application No. PCT/EP2014/063890,filed on Jul. 1, 2014, which claims the benefit of European PatentApplication No. 13176612.3, filed on Jul. 16, 2013. These applicationsare hereby incorporated by reference herein.

FIELD OF THE INVENTION

The invention relates to mapping between linear luminance values andluma codes, and in particular, but not exclusively to encoding of one orpreferably more (i.e. video) high dynamic range (HDR) image(s), fittinginto the current frameworks of existing technology, like e.g. blu-raydisk storage, or HDMI cable connections.

BACKGROUND OF THE INVENTION

Conventionally, the dynamic range of reproduced images has tended to besubstantially reduced in relation to normal vision. Indeed, luminancelevels encountered in the real world span a dynamic range as large as 14orders of magnitude, varying from a moonless night to staring directlyinto the sun. Instantaneous luminance dynamic range and thecorresponding human visual system response can fall between 10.000:1 and100.000:1 on sunny days or at night (bright reflections versus darkshadow regions). Traditionally, dynamic range of displays has beenconfined to about 2-3 orders of magnitude, and also sensors had alimited range, e.g. <10.000:1 depending on noise acceptability.Consequently, it has traditionally been possible to store and transmitimages in 8-bit gamma-encoded formats without introducing perceptuallynoticeable artifacts on traditional rendering devices. However, in aneffort to record more precise and livelier imagery, novel High DynamicRange (HDR) image sensors that are capable of recording dynamic rangesof more than 6 orders of magnitude have been developed. Moreover, mostspecial effects, computer graphics enhancement and other post-productionwork are already routinely conducted at higher bit depths and withhigher dynamic ranges.

Furthermore, the contrast and peak luminance of state-of-the-art displaysystems continues to increase. Recently, new prototype displays havebeen presented with a peak luminance as high as 3000 cd/m² and contrastratios of 5-6 orders of magnitude (display native, the viewingenvironment will also affect the finally rendered contrast ratio, whichmay for daytime television viewing even drop below 50:1). It is expectedthat future displays will be able to provide even higher dynamic rangesand specifically higher peak luminances and contrast ratios.

HDR images may for example be generated by combining a plurality oflow-dynamic range (LDR) images. For example, three LDR images may becaptured with different ranges and the three LDR images may be combinedto generate a single image with a dynamic range equal to the combinationof the dynamic ranges of the individual LDR images.

In order to successfully introduce HDR imaging and to fully exploit thepromise of HDR, it is important that systems and approaches aredeveloped which can handle the increased dynamic range. Furthermore, itis desirable if functions are introduced which allow various elementsand functions of LDR image processing to be re-used with HDR. E.g. itwould be desirable of some of the interfaces, communication means ordistribution mediums defined for LDR could be reused for HDR images.

One important feature associated with HDR imaging is that of how toefficiently encode HDR image data.

Recently several HDR encoding technologies have been proposed, like e.g.the dual layer method of Dolby as disclosed in WO2005/1040035.

In order to e.g. efficiently process HDR images it is in many scenariosimportant that the larger dynamic range of HDR typically represented bya relatively large number of bits is converted into a representationusing a substantially reduced number of bits.

For example, in some scenarios, it may be advantageous to view HDRimages on a display having an input interface developed for LDR. Thus,it may be desirable to generate values that can be treated as LDR valuese.g. by the display interface. In other scenarios, it may be desirableto encode the HDR values with lower bit rates and with some backwardscompatibility to LDR.

In order to represent LDR images in a suitable format, it is often usedto employ a code allocation function which maps from HDR linearluminance values to suitable quantized luma codes. The HDR linearluminance values are often represented as e.g. floating point valueswith a relatively high number of bits per value (e.g. 16 bits). Incontrast, the quantized luma codes typically represent luma values by arelatively low number of bits (e.g. 8 bits), and often as integervalues.

The difference between LDR and HDR is not just the size of the dynamicrange, Rather, the relative distribution of intensities in most scenesis also substantially different for LDR and HDR representations.

Indeed, HDR images/video typically have a different intensitydistribution than the conventional (LDR) images/video. Especially thepeak-to-average luminance ratio of high-dynamic-range image data is muchhigher. Therefore, the currently applied code allocation curves orelectro optical transfer functions (EOTFs) tend to be sub-optimal forHDR data. Thus, if a conventional LDR mapping from HDR luminance valuesto encoded luma values is used, a significant image degradationtypically occurs. For example, most of the image content can only berepresented by a few code values as a large number of codes are reservedto the increased brightness range which is however typically only usedfor a few very bright image objects.

As an example of a practical scenario, color grading (see reference [1])or color correction is an integral part of commercial film orphotography production. In particular, it is part of the post-productionstage (reference [2]). The color grading artist, or colorist, operatesin a color grading suite, which provides color grading/correction toolsas well as a real-time preview of the effects of color grading tooloperations on the image or video being graded/corrected.

With the introduction of HDR cameras and displays for shooting anddisplaying HDR images and video, the color grading suite also has to bemade suitable for grading this high-dynamic-range content. To facilitatethe introduction of HDR, it is beneficial to enable the colorgrading/correction with minimal changes to existing tools.

Current standard dynamic range video, intended to be displayed on areference monitor of e.g. 100 cd/m² peak brightness, is usually encodedin current standard luma/luminance domains, which are specified usingtheir log curves or EOTFs (electro-optical transfer functions). Examplesof this are the curves used for sRGB (reference [4]) or ITU Rec. 709(reference [5]) logarithmic data. The video data is sent in thislogarithmic domain from the color grading tool (e.g. software on a PC)over a hardware interface (typically HD-SDI) to the preview display. Thebit depth of the hardware interface is usually limited to e.g. 8 or 10bits.

HDR images/video typically have a different brightness (e.g. whendefined as display rendered luminance) distribution than currentstandard dynamic range images. For example, while the current videocontent distribution typically peaks around 20% of peak brightness(which means that the luma codes are nicely spread around the half ofe.g. 255 values), HDR content may oftentimes typically peak around amuch lower percentage, e.g. 1%, of peak brightness (data of at least thedarker regions of the HDR images spread around the code 1/100^(th) ofcode maximum). Thus, most of the relevant HDR content will be containedin only a few of the 8-bit or 10-bit video levels when it is encodedusing current standard log curves. This will lead to severe andunacceptable quantization artifacts in the preview image, thuspreventing the colorist to color grade/correct HDR images.

Accordingly, if conventional code allocations functions are used for HDRimages in order to generate suitable codes for existing displays withsuch 8-bit or 10-bit input formats, a substantially reduced quality ofthe displayed image will result with e.g. most of the intensitiespresent in the image being distributed over only a few input levels.

The code allocation function mapping linear light luminances as how theyare to be seen upon display rendering to actual technical codes, or viceversa, have however largely been based upon LDR models (like gamma 2.2),but were optimal only for LDR displays of peak brightness of around 100nit or cd/m² (henceforth both the terms nit and cd/m² will be used). Ifone so coarsely codes HDR video for transmission over a connection cableto a HDR display (e.g. peak brightness of 5000 nit) one risks seeingartefacts, such as banding in the darker parts of the video (e.g.banding in a dark blue sky, especially for fades).

Accordingly, in order to e.g. enable color grading of HDR images usingthe current color grading tools and interfaces, a different codeallocation curve should be used for encoding the video data, such that asufficient number of quantization levels is assigned to the mostimportant video data.

However, finding a suitable code allocation function is not onlycritical but also difficult. Indeed, a challenge when determining codeallocation functions is that of how to best map between the inputluminance values and the luma codes. Indeed, this is a critical issue asthe selected mapping has a strong impact on the resulting quality (e.g.due to quantization error). Furthermore, the impact on image quality maybe dependent on the characteristics and properties of the images beingencoded/decoded as well as the equipment used for rendering the images.

Of course, the simplest approach would be to simply use a uniformquantization. However, such an approach tends to result in suboptimalperformance in many scenarios. Accordingly, code allocation functionshave been developed wherein a non-uniform quantization has been applied.This may specifically be performed by applying a non-linear function(luma code mapping/tone mapping function) to the input luminance valuesfollowed by a linear quantization. However, as mentioned, it has beenfound that the defined functions in many scenarios provide a suboptimalresult. For example, applying a code allocation function to HDR imagesin order to e.g. allow these to be processed by LDR circuits with arelatively low number of bits per value (typically 8 bits) tends toresult in suboptimal conversion of the HDR image and specifically in theimage values being concentrated around a few quantization levels/codes.

Although it may be possible to develop and define explicit functionsthat are specifically optimized for e.g. HDR images, this may beimpractical in many scenarios. Indeed, such an approach requiresindividual and specialized functions to be developed for each scenario.Furthermore, it typically requires a large number of possible functionsto be available for selection in order to compensate for differences inthe images and/or equipment.

This further complicates operation and introduces additional resourcerequirements.

E.g. using dedicated functions not only requires the encoder tocommunicate which specific functions are used but in addition both theencoder and decoder need to store local representations of all possiblefunctions. This will substantially increase the memory storagerequirements. Another option would be for the encoder to encode datawhich fully defines the code allocation function used but such anapproach will substantially increase the data rate.

Furthermore, using dedicated and explicit HDR code allocation functionswill in many scenarios require substantial work in standardizing andspecifying suitable functions. Furthermore, backwards compatibility willbe a problem as existing equipment will not support new functions. E.g.existing circuitry will not be able to support new functions definedspecifically to support HDR images.

Accordingly, an improved approach for providing and/or generating codeallocation functions would be advantageous.

SUMMARY OF THE INVENTION

According to an aspect of the invention there is provided a method ofconstructing a code allocation function in accordance with claim 1.

The invention may allow facilitated or improved e.g. communication,storage, processing or manipulation of images in many scenarios.

The approach may in particular allow facilitated or improved e.g.communication, storage, processing or manipulation of HDR images in manyscenarios, and may in particular allow HDR images to use existingfunctionality designed for LDR images. E.g. the code allocation functionmay allow improved HDR image representation over a link or functionalityrestricted to a reduced number of bits.

The use of partial functions as defined has been found to provide animproved image representation and/or facilitate operation in manyembodiments. In particular, it may in many embodiments allow existingtone mapping functions to be reused for new applications and scenarios.In particular, it may in many embodiments allow existing functions e.g.defined or determined for LDR image processing and representation to bereused for mapping HDR linear luminances to luma representationsproviding a representation of the HDR image with fewer bits per pixel.Also, by using a few partial functions in combination, a large varietyof code allocation functions can be supported while only requiring e.g.storage or communication of the few partial functions.

A luma value or code may be any non-linear function of a (colorless)luminance value. Thus, the luma value typically provides a monotonousnon-linear representation of the corresponding luminance but thefunction relating the luma value to luminance may be any suitable andspecifically non-linear function.

For the linear luminance value there is a direct linear relationshipbetween the luminance value and the desired radiated light, i.e. adirect linear relationship between the linear luminance value and acorresponding light radiation from the pixel.

In some embodiments, the code allocation function may be part of anencoder. Pixel luminance values may be input to the code allocationfunction thereby generating quantized luma values. These values may bee.g. communicated, processed or encoded.

The partial functions may be sequentially applied. The application ofthe first partial function may preceed the second partial function, andspecifically the first luma output value may in some embodiments be fedto the second partial function, i.e. the luma input value may be thefirst luma output value.

The code allocation function may include a quantisation of the secondluma output value to generate the luma code values. The luma codes maybe generated from the second luma output value in response to aquantisation which typically is a linear quantisation. The quantisationmay provide a reduction of the number of bits representing each pixelluma value, and may include a conversion of representation e.g. from afloating point value to an integer value.

A maximum range for a value includes all values that the value can take.The maximum luminance range of pixel linear luminance input valuesincludes all possible values of the linear luminance input value. Themaximum luma range of a first luma output value includes all possiblevalues of the first luma output value. The maximum luma range of theluma input value includes all possible values of the luma input value.The maximum luma range of the second luma output value includes allpossible values of the second luma output value.

One or more of the maximum ranges may be the same. For example, allmaximum luma ranges may be normalized to the [0;1] interval. The maximumlinear luminance range may similarly be represented by values in the[0;1] interval.

The partial functions may be fixed functions or may be dependent on oneor more parameters.

In accordance with an optional feature of the invention, there isprovided claim 6.

This may provide an efficient and flexible system and may allow a sourceor transmitting end to flexibly optimize the code allocation functionwhile allowing a sink or receiving end to adapt to the specific codeallocation function used.

The representation may be encoded as any data indicative of acharacteristic of the code allocation function, such as e.g. by encodinga representation of the entire code allocation function or an indicationof one or more of the partial functions, and/or a parameter of these.

According to an aspect of the invention there is provided a method ofdetermining a code mapping function for mapping from luma codes to pixellinear luminances function in accordance with claim 12.

The invention may allow facilitated or improved e.g. communication,storage, processing or manipulation of images in many scenarios.

The approach may in particular allow facilitated or improved e.g.communication, storage, processing or manipulation of HDR images in manyscenarios, and may in particular allow HDR images to use existingfunctionality designed for LDR images. E.g. the code allocation functionmay allow improved HDR image representation over a link or functionalityrestricted to a reduced number of bits.

The code mapping function may include an inversion of at least part of acode allocation function used to generate the luma codes. The firstpartial function may be an inverse function of a mapping of a luma valueto a luma code of a code allocation function used to generate the lumacodes. The second partial function may be an inverse function of amapping of a linear luminance value to a luma value of a code allocationfunction used to generate the luma codes.

The use of partial functions as defined has been found to provide animproved image representation and/or facilitate operation in manyembodiments. In particular, it may in many embodiments allow existingtone mapping functions to be reused for new applications and scenarios.In particular, it may in many embodiments allow existing functions e.g.defined or determined for LDR image processing and representation to bereused for mapping HDR linear luminances to luma representationsproviding a representation of the HDR image with fewer bits per pixel,and for undoing this mapping at the receiving/sink side. Also, by usinga few partial functions in combination, a large variety of codeallocation functions can be supported while only requiring e.g. storageor communication of the few partial functions.

In some embodiments, the code mapping function may be part of a decoder.Luma codes may be received from e.g. a remote source and converted intolinear luminance pixel values.

The partial functions may be sequentially applied. The application ofthe first partial function may preceed the second partial function, andspecifically the luma output value of the first partial function may insome embodiments be fed to the second partial function, i.e. the inputluma value of the second partial function may be the luma output valueof the first partial function.

The code mapping function may include a de-quantisation of e.g. the lumacode prior to mapping by the first partial function.

A maximum range for a value includes all values that the value can take.The maximum luminance range of pixel linear luminance input valuesincludes all possible values of the linear luminance input value. Themaximum luma range of a luma output value includes all possible valuesof the luma output value. The maximum luma range of the luma input valueincludes all possible values of the luma input value. The maximum lumarange of the luma code includes all possible values of the luma code.

One or more of the maximum ranges may be the same. For example, allmaximum luma ranges may be normalized to the [0;1] interval. The maximumlinear luminance range may similarly be represented by values in the[0;1] interval. The partial functions may be fixed functions or may bedependent on one or more parameters.

In some embodiments, the partial functions may be generated in responseto data received together with image data to be converted from lumacodes to linear luminance values in accordance with the code mappingfunction.

BRIEF DESCRIPTION OF THE DRAWINGS

These and other aspects of the method and apparatus according to theinvention will be apparent from and elucidated with reference to theimplementations and embodiments described hereinafter, and withreference to the accompanying drawings, which serve merely asnon-limiting specific illustrations exemplifying the more generalconcept.

FIG. 1 illustrates an example of an apparatus for generating a codeallocation function in accordance with some embodiments of theinvention;

FIG. 2 illustrates an example of an apparatus for generating a codemapping function in accordance with some embodiments of the invention;

FIG. 3 illustrates an example of a code mapping function in accordancewith some embodiments of the invention;

FIG. 4 schematically shows how one can apply a curve prior to aquantization phase to N bit in a coding, and a reverse curve toapproximately reconstruct the original input signal.

FIG. 5 schematically shows how typically such a strategy is applied tothree color coordinates of a pixel, e.g. RGB.

FIG. 6 schematically shows an embodiment of our invention where ourtotal code allocation curve to be applied (luma Y, or non-linear R(G,B)=f [corresponding coordinate of linear color space representationof typically HDR input image]) is formed out of three partial mappingfunctional forms.

FIG. 7 schematically shows another embodiments, in which some parts havea compressive action on the lumas of a luminance range of the total codespace, and others an expansive action in that subrange.

FIG. 8 schematically shows which first partial function we have found togive an optimized code allocation when HDR is typically in a rangeending with a peak brightness of around 5000 nit, and a lower end around0.1 nit or below, in case the second partial function is the codeallocation function of the sRGB standard.

FIG. 9 schematically shows an optimally working first partial functionfor HDR encoding over lower bit amount code words (e.g. 8 bit, 10 bit,12 bit) when one uses as second partial the rec. 709 code mapping.

FIG. 10 schematically shows an optimally working first (or one could ofcourse also use it last in actual application succession) partial whenusing Dolby's PQ function as second partial.

FIG. 11 schematically shows that one can also construct the total codeallocation function out of more partial functions, in this case two sRGBmappings are used in succession, after a final gamma correction bendingthe allocation function in the correct final shape, so that sufficientcodes exist for all luminance regions typically in an HDR image.

FIG. 12 schematically shows the same when using two classical Rec. 709functions, but in a non-classical double application.

FIG. 13 schematically shows how such code allocation functions look overthe code space, mapping X-axis input code values to output Y-axisluminances.

FIGS. 14-16 illustrates examples of a code mapping function;

DETAILED DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates an example of an HDR image processing system inaccordance with some embodiments of the invention. The figureillustrates a source, encoding or transmitting side for an HDR system.In the example, a code allocation function is used to map from inputvalues that are HDR linear luminances into luma codes. In the example,the code allocation function maps from input values represented by Nbits into output values represented by M-bits where N>M. In addition, inthe example, the input HDR linear luminance values are represented asfloating point values (e.g. as 16 bit floating point values) and theoutput luma codes are represented by integers (e.g. as 8 bit integers).

In the example of FIG. 1, the system comprises a source 101 of an HDRimage or video sequence.

Conventional displays typically use an LDR representation. Typically,such LDR representations are provided by a three component 8 bitrepresentation related to specified primaries. For example, an RGB colorrepresentation may be provided by three 8 bit samples referenced to aRed, Green, and Blue primary respectfully. Another representation usesone luminance component and two chroma components (such as YCbCr). TheseLDR representations correspond to a given brightness or luminance range.

HDR specifically allows for significantly brighter images (or imageareas) to be presented appropriately on HDR displays. Indeed, an HDRimage displayed on an HDR display may provide a substantially brighterwhite than can be provided by the corresponding LDR image presented onan LDR display. Indeed, an HDR display may allow typically at least afour times brighter white than an LDR display. The brightness mayspecifically be measured relative to the darkest black that can berepresented or may be measured relative to a given grey or black level.

The LDR image may specifically correspond to specific displayparameters, such as a fixed bit resolution related to a specific set ofprimaries and/or a specific white point. For example, 8-bits may beprovided for a given set of RGB primaries and e.g. a white point of 500cd/m2. The HDR image is an image which includes data that should berendered above these restrictions. In particular, a brightness may bemore than four times brighter than the white point (e.g. 2000 cd/m2) ormore.

High dynamic range pixel values have a luminance contrast range(brightest luminance in the set of pixels divided by darkest luminance)which is (much) larger than a range that can be faithfully displayed onthe displays standardized in the NTSC and MPEG-2 era (with its typicalRGB primaries, and a D65 white with maximum driving level [255, 255,255] a reference brightness of e.g. 500 nit or below). Typically forsuch a reference display 8 bits suffice to display all grey valuesbetween approximately 500 nit and approximately 0.5 nit (i.e. withcontrast range 1000:1 or below) in visually small steps, whereas HDRimages are encoded with a higher bit word, e.g. 16 bit. In particular,HDR images typically contain many pixel values (of bright image objects)above a scene white. In particular, several pixels are brighter than twotimes a scene white. This scene white may typically be equated with thewhite of the NTSC/MPEG-2 reference display.

It should be noted that the difference between LDR and HDR images is notmerely that a larger number of bits are used for HDR images than for LDRimages. Rather, HDR images cover a larger luminance range than LDRimages and typically have a higher maximum luminance value, i.e. ahigher white point. Indeed, whereas LDR images have a maximum luminance(white) point corresponding to no more than 500 nits, HDR images have amaximum luminance (white) point corresponding to more than 500 nits, andoften no less than 1000 nits, 2000 nits or even 4000 nits or higher.Thus, an HDR image does not merely use more bits corresponding to ahigher granularity or improved quantization but rather corresponds to alarger actual luminance range. Thus, the brightest possible pixel valuegenerally corresponds to a luminance/light output which is higher for anHDR image than for an LDR image. Indeed, HDR and LDR images may use thesame number of bits but with the HDR image values being referenced to alarger luminance dynamic range/brighter maximum luminance than the LDRimage values (and thus with the HDR images being represented with a morecoarse quantization on a luminance scale).

The number of bits used for the HDR images X may typically be largerthan or equal to the number of bits Y used for LDR images (X maytypically be e.g. 12, 14 or 16 bit (per color channel if several of thechannels are used), and Y may e.g. be 8, or 10 bits).

In order to allow HDR images to be used with LDR compatible equipment orinterfaces, such as LDR compatible display interfaces or image encodingalgorithms, a transformation/mapping may be required to fit the HDRvalues into a smaller range, e.g. a compressive scaling may be desired.Such conversions are typically rather complex and do not merely equateto a simple scaling of the luminance ranges as such a scaling wouldresult in an image which would be perceived as unnaturally looking andtypically with a large quantization error. Rather complextransformations are typically used and these transformations are oftenreferred to using the term tone mapping.

In the system of FIG. 1, the HDR image is fed to a code allocationfunction 103 which maps the linear luminance values of the pixels of theHDR image into luma codes with a reduced number of bits being providedfor each luma code than for each linear luminance value.

The code allocation function thus has an input value which is a linearluminance value of the HDR image.

A luminance value for a given pixel is indicative of a luminance of thatpixel, i.e. it is indicative of an amount of light that should beprovided radiated by that pixel (and thus of the brightness that will beperceived by the pixel. In the example, the luminance input value islinked to a given level in terms of a maximum luminance, i.e. in termsof a white point. For example, the input luminance may be provided as avalue in a given range where the range is linked to a radiated luminancelevel. Specifically, the low end of the range may be linked to a blackpoint e.g. corresponding to no light being radiated. The high end of therange may be linked to a white point. The white point is an HDRluminance, such as for example 5000 nits or 1000 nits.

Thus, the input to the code allocation function may be a luminance valuewhich may be linked to an actual white point and black pointcorresponding to radiated light values. For example, the input luminancevalues may be given as a value in the range of [0;1] where the value 0corresponds to a black point of e.g. 0 nits, and the value 1 correspondsto a white point of more than 500 nits, and often to no less than 1000nits, 2000 nits or even 4000 nits or higher.

Thus, a given luminance value directly corresponds to a desiredbrightness.

The input luminance value from the HDR source 101 is in the example alinear luminance value. Thus, there is a direct linear relationshipbetween the luminance value and the desired radiated brightness, i.e. adirect linear relationship between the linear luminance value and thecorresponding light radiation from the pixel. For example, for aluminance value in the range of [0;1] where 0 corresponds to a blackpoint of 0 nits and 1 corresponds to a white point of 5000 nits, a valueof 0.25 corresponds to a brightness of 1250 nits, a value of 0.5corresponds to a brightness of 2500 nits etc.

The input luminance value is represented by a relatively high number ofbits and thus a relatively high accuracy. It may furthermore berepresented as a floating point value. Thus, the linear luminance can beconsidered substantially unquantized.

In the example, the luminance value may specifically be an overallluminance of the pixel, i.e. it may reflect the brightness of the entirepixel rather than just a luminance of a color channel (such as an Rchannel luminance, G channel luminance or B channel luminance). Forexample, in the example, the pixel colors may be represented by a formatcomprising separate luminance and chroma components. For example, theymay be provided in an Yuv format (in which a pixel value is representedby a luminance value Y and two chroma values uv). In this case, the codeallocation function may be applied to the Y component (the luminancecomponent) while keeping the chroma components uv constant. In someembodiments, the system may comprise a color representation converter toconvert the input values from e.g. an RGB format to e.g. an Yuv format.

The linear luminance input may specifically be a linear luminance asreferred to by SI and CIE.

The input signal to the code allocation function may thus be a luminancevalue associated with an actual brightness level, i.e. with a specificwhite point or maximum luminance. Specifically, the HDR source 101 mayprovide an image which has been color graded for the specific brightnesslevel. E.g. a color grader may manually have adjusted the pixelcolors/luminance values of the HDR image to get a desired aestheticallypleasing image when presented on an HDR display with a white pointcorresponding to the white point linked to the input luminance range.

The output of the code allocation function 103 is a luma value or code.A luma may be any non-linear function of a colorless luminance value.Thus, the luma value typically provides a monotonous representation ofthe corresponding brightness but the function relating the luma value topixel brightness may be any suitable and specifically non-linearfunction. Thus, for the luma values, a value twice as large as anothervalue cannot be assumed to correspond to a desired brightness beingtwice as large. In some scenarios, the luma value can be considered tonot be directly linked to a given brightness range. For example, theavailable range for a luma value may be given, e.g. as a range from[0;1] or e.g. [0;255]. However, this range may not be linked directlywith a given brightness range or indeed with a given black point orwhite point. For example, in some embodiments, the luma value mayprovide an abstract representation of the image brightness range ordistribution and the exact mapping to specific brightness levels may beadapted depending on e.g. the brightness qualities of the display usedto present the image.

The luma values may specifically correspond to the luminance notationfrom CIE_XYZ.

Thus, a luma value for a pixel may provide a representation of abrightness or luminance value for the pixel but may not have apredetermined or direct mapping to these values, and in particular maynot represent a linear mapping. Rather, the luma value provides anencoding but in order to map the luma code back to specific brightnessvalues, it is necessary to use a function defining the relationshipbetween the luma codes and the original linear luminance values. In theencoder of FIG. 1, the code allocation function maps from the linearluminance input to luma codes. In order to map the luma codes back toluminance codes, an inverse code allocation function can be applied.Specifically, in order to map the luma codes back to the linearluminance range of the input to the encoder, the inverse of the codeallocation function may be used to generate the luminance values. Themapping from luma codes to luminance values is in the following referredto as an inverse code allocation function. However, it should be notedthat this function may also in some scenarios itself be referred to as acode allocation function.

The code allocation function 103 includes a non-linear mapping whichmaps the linear luminance values to a luma value which is thenquantized. Specifically, the code allocation function includes a lumacode mapping 107 which maps the linear luminance input value to a lumavalue. The mapping is a non-linear mapping. The luma value at the outputof the luma code mapping 107 is fed to a quantizer 109 which performs aquantization of the luma value to generate an output luma code from thecode allocation function 103.

The quantizer 109 performs a bit reduction such that the higher numberof bits of the linear luminance value is reduced to the lower number ofbits that allows the use of existing LDR functionality. Specifically,the quantizer 109 may reduce the number of bits of the luma value from Nto M. The quantizer 109 specifically performs a uniform quantization.

The luma code mapping 107 is arranged to perform a non-linear mappingfrom the linear luminance input to the unquantized luma value. Thecombined effect of the luma code mapping 107 and the quantizer 109 maythus correspond to a non-uniform quantization.

The non-linear mapping may specifically ensure that the distribution ofvalues is improved. For example, the non-linear mapping may be such thatthe darkest, say, 10% of the range of the input luminance values ismapped to the darkest, say, 70% of the range of the unquantized lumavalue. This will ensure an efficient encoding of the imagecharacteristics of the HDR image using the reduced resolution typicallyassociated with LDR images.

Thus, in the system of FIG. 1, the code allocation function isconstructed from a luma code mapping 107 applied to the linear luminanceinput value to generate a luma value followed by a (linear) quantizationof the luma value to generate the output luma code. The luma codemapping 107 provides a mapping which maps the input linear luminance toa luma value, i.e. the luma code mapping 107 may be considered toprovide a tone mapping from linear luminance values to luma values.

However, in the system, the luma code mapping 107 is not merelyconstructed as a single function or mapping but rather is constructedfrom two partial functions 111, 113 or mappings which work together toprovide the overall mapping of the luma code mapping 107. In the exampleof FIG. 1 the luma code mapping 107 is made up of only a first andsecond partial function 111, 113 but it will be appreciated that inother embodiments, the luma code mapping 107 may include furtherfunctions and especially may include additional mappings. For example,as will be described later, the code allocation function may include avariable mapping which can be modified by a user, indeed in someembodiments, the code allocation function may include a color gradingcontrolled by a user.

Specifically, in the system of FIG. 1, the luma code mapping 107comprises a first partial function 111 which receives the linearluminance input value from the HDR source 101. The first partialfunction 111 is arranged to map the linear luminance input value to afirst luma value. The first partial function 111 defines an output lumavalue for all possible linear luminance input values, i.e. the entiremaximum luminance range which can be represented by a linear luminanceinput value is mapped to an output luma range. Furthermore, the mappingof the first partial function 111 is such that it maps the maximumluminance range which can be represented by the linear luminance inputvalue to a maximum luma range that can be represented at the output.Specifically, the lowest possible linear luminance input value is mappedto the lowest possible luma value. Similarly, the highest possiblelinear luminance input value is mapped to the highest possible lumavalue.

Furthermore, the mapping is a non-linear mapping. Typically, the mappingis such that subranges corresponding to typical brightness values areincreased, and subranges that correspond to very high brightness valuesare compressed. Thus, the HDR distribution is mapped to a distributionwhich may be more suitable for LDR restrictions (specifically bitrestrictions).

The mapping of the first partial function 111 is furthermore aninvertible function. Specifically, the first partial function 111provides a one to one mapping from the luminance input to the lumaoutput, and indeed there exists a one-to-one mapping from the lumaoutput to the luminance input. Thus, the first partial function 111 is asurjective or bijective function/mapping. For every possible linearluminance input value of the range of the linear luminance input, thefirst partial function 111 maps to exactly one luma value of the rangeof the luma output. Furthermore, an inverse of the first partialfunction 111 exists which for every possible luma value of the range ofthe luma output maps to exactly one linear luminance input value of therange of the linear luminance input.

Specifically, the linear luminance input value may be represented by(e.g. floating point) values in the interval from [0;1]. Similarly, theluma values may be represented by floating point values in the intervalfrom [0;1]. The first partial function 111 may provide a bijective,non-linear mapping of the luminance input value range [0;1] into theluma output value [0;1].

In the example of FIG. 1, the output of the first partial function 111is fed to a second partial function 113.

The second partial function 113 is arranged to map a luma value, andindeed in the specific example of FIG. 1, the luma value from the firstpartial function 111, to a second luma value. The second partialfunction 113 defines a luma output value for all possible luma inputvalues, i.e. the entire maximum luma range which can be represented bythe luma input value is mapped to an output luma range. Furthermore, themapping of the second partial function 113 is such that it maps theinput luma range to a maximum luma range that can be represented at theoutput. Specifically, the lowest possible luma input value is mapped tothe lowest possible luma output value. Similarly, the highest possibleluma input value is mapped to the highest possible luma output value.

Furthermore, the mapping is a non-linear mapping. In many scenarios, themapping is such that subranges corresponding to typical brightnessvalues are increased and subranges that correspond to very highbrightness values are compressed. Thus, the HDR distribution is mappedto a distribution which may be more suitable for LDR restrictions.

The mapping of the second partial function 113 is furthermore aninvertible function. Specifically, the second partial function 113provides a one to one mapping from the luma input to the luma output andindeed there exists a one-to-one mapping from the luma output to theluma input. Thus, the second partial function 113 is a surjective orbijective function/mapping. For every possible luma input value of therange of the luma input, the second partial function 113 maps to exactlyone luma value of the range of the luma output. Furthermore, an inverseof the second partial function 113 exists which for every possible lumavalue of the range of the luma output maps to exactly one luma inputvalue of the range of the linear luma input.

Specifically, the luma input value may be represented by values in theinterval from [0;1]. Similarly, the luma output values may berepresented by values in the interval from [0;1]. The second partialfunction 113 may provide a bijective, non-linear mapping of the lumavalue range [0;1] into the luma output value [0;1]. The luma values maybe floating point values.

The overall combined effect of the subsequent application of the firstpartial function 111 and the second partial function 113 is accordinglya non-linear mapping from the input linear luminance representation ofan HDR signal to a representation that is more suitable forrepresentation by fewer bits. Thus, a combined non-linear luma codemapping or tone mapping of input linear luminances to luma values isachieved

In the system of FIG. 1, the second luma output value, i.e. the lumavalues from the second partial function 113 are fed to a quantizer 109.The quantizer 109 applies a quantization to the second luma valuethereby generating output luma codes.

The quantization by the quantizer 109 reduces the number of bits used torepresent each pixel brightness to fewer bits. For example, the lumavalue may be a 16 bit floating point value, and this may be quantizedinto 8 or 10 bit integers.

As a result of the code allocation function, luma codes can thus begenerated which represent the HDR brightness with substantially fewerbits while allowing the fewer bits to provide a reasonablerepresentation of the original HDR image. Indeed, the code allocationfunction may generate codes that can be handled by e.g. communication,encoding or image processing functionality that has been developed forLDR.

For example, a display interface may be defined to support e.g. imagerepresented as Yuv data with e.g. 10 bits allocated for the Y component.Such a display interface may have been designed with LDR in mind.However, by mapping the HDR linear luminance to luma codes of 10 bits,the same display interface can also be used to support the HDR images.

As another example, an encoding algorithm may be generated based on Yuvrepresentations using 8 bits for the Y component. By mapping the HDRlinear luminance to eight bit luma codes, the same encoding algorithmcan be used to support encoding of the HDR image.

Thus, the system of FIG. 1 effectively compresses the HDR linearluminance into a luma representation which in many scenarios allows theresulting signal to be handled by LDR functionality. In particular, theresulting signal may be communicated using a communication medium,channel or intermediate which has been designed for LDR.

Furthermore, this may be achieved while still allowing an efficientrepresentation of the HDR characteristics. Thus, the image data is notconverted to an LDR image which is then used. Rather, an HDRrepresentation within an LDR compatible container can be used.

In many embodiments, a receiver may receive the luma code values andseek to generate a linear luminance HDR representation. For example, anHDR display receiving the luma values may seek to generate HDR linearluminance values which are then used to drive the display.

An example of such a sink, decoding or receiving end is illustrated inFIG. 2.

In the example, the receiver comprises an image receiver 201 whichreceives the coded values generated from the transmitting end of FIG. 1.It will be appreciated that in some embodiments, the luma codes may bereceived in an encoded signal and the data receiver 201 may comprisefunctionality for decoding the encoded signal to retrieve the lumacodes. It will also be appreciated that the encoded signal may furthercomprise chroma values, e.g. a luma code and chroma values may beprovided for each pixel in an image, e.g. each pixel may be representedin an Yuv format.

The received luma codes are fed to a code mapping function 203 which isarranged to map the receive luma codes into linear luminance values. Thecode mapping function 203 specifically provides a non-linear mappingwhich may generate linear luminance values that are suitable for HDRimages.

The linear luminance values are in the example fed to a driver 205 whichis arranged to drive an HDR display. Thus, in the specific example, thereceiver may e.g. be an HDR display comprising functionality forreceiving luma codes representing an HDR image but using a format thatallows the luma codes to be compatible with an LDR communicationchannel, and for converting these luma codes to HDR linear luminancevalues.

In some embodiments, the code mapping function 203 may correspond to theinverse function of the code allocation function 103. Thus, the mappingperformed by code mapping function 203 may reverse the operation of lumacode mapping 107 when generating linear luminance values.

In other embodiments, the code mapping function 203 may comprisemodified or additional mapping. For example, the mapping to HDRluminance values may be adapted to local characteristics or preferences,such as e.g. to the white point of the specific display or to e.g.specific user preferences.

However, in general, the code mapping function 203 is generated to takeinto account the code allocation function/luma code mapping 107 of thetransmitting end. This approach thus allows a system wherein an HDRlinear luminance range can be mapped to an LDR format compatiblerepresentation, communicated using a communication channel restricted toLDR formats, and then at the far end be mapped back to the HDR linearluminance range.

The code mapping function 203 is generated in response to two partialfunctions which in the following will be referred to as a first inversepartial function and a second inverse partial function. In the specificexample, the first inverse partial function is the inverse function ofthe first partial function of the transmitter of FIG. 1 and the secondinverse partial function is the inverse function of the second partialfunction 113 of the transmitter of FIG. 1.

The second inverse partial function accordingly provides a mapping of areceived luma code to a luma value and the first inverse partialfunction provides a mapping of a luma value to a linear luminance value.

It will be appreciated that the first inverse partial function andsecond inverse partial function have corresponding characteristics tothe first partial function 111 and the second partial function 113 asthey are inverse functions.

Specifically, the first inverse partial function defines a non-linearinvertible mapping of a maximum luma range of an input luma value to amaximum luminance range of pixel linear luminance input values.

Correspondingly, the second inverse partial function defines anon-linear invertible mapping of a maximum luma range of an input lumacode to a maximum luma range of a luma output value.

Accordingly, in the example, the receiver comprises a partial functiongenerator 209 which is arranged to determine the partial functions to beused in the receiver. Specifically, the partial function generator 209may determine the first inverse partial function and the second inversepartial function.

In some embodiments, the first inverse partial function and secondinverse partial function may e.g. be generated based on localinformation or e.g. a user input which defines the inverse partialfunctions.

However, in many embodiments the first inverse partial function and thesecond inverse partial function are determined based on control datareceived together with the image data. Specifically, the transmitter ofFIG. 1 may include data defining the first partial function 111 and thesecond partial function 113. The data may in some embodiments simplydefine an identity of the two functions and the receiver of FIG. 2 maycomprise a local store in which different functions are stored togetherwith associated identifications. In some embodiments, the received datamay furthermore comprise one or more parameters for the partialfunctions. For example, a gamma function may be identified and a gammavalue may be provided in the received data stream as a parameter for thegamma conversion.

The partial function generator 209 is coupled to a mapping generator 211which is arranged to generate the code mapping function 203 based on thedetermined partial functions. The mapping generator 211 may for exampledirectly generate the code mapping function 203 as a sequentialapplication of the second inverse partial function and the first inversepartial function.

Indeed, in some embodiments, the code mapping function 203 may begenerated as a sequential application of the second inverse partialfunction and the first inverse partial function. Indeed, the receivedinput luma codes may be fed to the second inverse partial function, andthe luma output values of the second inverse partial function may be feddirectly to the first inverse partial function. In some embodiments, theresulting linear luminance value may be used directly, and indeed thislinear luminance will correspond to that of the original HDR image.

FIG. 3 illustrates an example of the code mapping function 203 whereinadditional mapping may be performed. In the example, the luma codes arefed to the second inverse partial function 301 which applies anon-linear mapping to generate luma output values. The luma outputvalues are fed to third function 303 which may perform a luma to lumamapping. This mapping may for example be an automated correction inaccordance with local preferences, or may even be a manual color gradingapplied to the luma values. The resulting luma values are then fed tothe first inverse partial function which maps these luma values intolinear luminance values.

It will furthermore be appreciated that rather than directly applyingthe first inverse partial function and the second inverse partialfunction, a modified version of at least one of these may be used. Forexample, the first inverse partial function may comprise a gammaconversion and the first inverse partial function may be arranged to usea different gamma value than that applied in the first partial function111. However, such an approach is equivalent to applying first the firstinverse partial function followed by a second function which maps fromthe resulting values to values corresponding to the modified gammafunction. In other words, even if applying e.g. a different gamma value,the information of the mapping in the encoder (e.g. by the first partialfunction 111) is still taken into account and thus the code mappingfunction 203 still depends on both the first inverse partial functionand the second inverse partial function.

It will also be appreciated that in some embodiments and scenarios, thecode mapping function 203 may also represent the mapping of thequantizer 109. Especially, if the quantizer includes a transformation ofrepresentation (e.g. from floating point to integer values), the effectthereof may be reversed by the code mapping function 203.

It will be appreciated that different approaches for determining theinverse functions and/or the code mapping function 203 may be used indifferent embodiments.

For example, as described above, in some embodiments the received datamay directly identify the first inverse partial function and the secondinverse partial function and the code mapping function 203 may bedetermined by applying these functions to the received data (e.g. inaddition to other mapping).

In some embodiments, the receiver may determine the code mappingfunction 203 by first determining at least part of the code allocationfunction, and then typically determining the inverse of that part of thecode allocation function.

For example, in some embodiments, the partial function generator 209 mayfirst determine the first partial function 111 and the second partialfunction 113 (or one of them) used in the encoder. It may then proceedto determine the inverse functions, i.e. the first inverse partialfunction from the first partial function 111 and the second inversepartial function from the second partial function 113. The determinationof the inverse functions may in some embodiments be based onpredetermined knowledge of which functions are the inverse functions ofthe possible functions that may be used as the first partial function111 or second partial function 113 by an encoder. In other embodiments,the definition of the first partial function 111 may e.g. be used togenerate a look-up table of linear luminance values and correspondingoutput luma values of the first partial function 111. This look up tablemay then be used as an inverse function by using the stored luma valuesas the input parameter. I.e. for a given luma value, the linearluminance value linked in the look up table may be retrieved. The sameapproach may of course be used for the second partial function 113 andsecond inverse partial function.

In the following, some specific advantageous embodiments will bedescribed in more detail including specifications of possible partialfunctions, code mapping functions, and code mapping function 203. In theexamples, the functions and mappings are for brevity and simplicityreferred to as curves.

In many embodiments, the code allocation function may be generated toprovide a logarithmic curve, i.e. the code allocation function maycorrespond to a log curve. In the approach, the log curve is constructedby a simple concatenation of existing log curves (i.e. partialfunctions) since these curves are readily available/implemented inexisting tools. In particular, it is proposed to use the sRGB, Rec709,and gamma curves as building blocks to construct a new log curve that issuitable for HDR. In its simplest form, the new curve is obtained byconcatenating only two of these building blocks, but by concatenatingthree of these blocks, curves with even smaller (less visible)quantization artifacts may be obtained.

The “building block” approach enables us to (1) quickly construct andevaluate a large number of curves and (2) take advantage of curves thatare already available in e.g. color grading tools.

A basic block diagram of applying a curve to an HDR signal is shown inFIG. 4 (note that all figures are just elucidating embodiments forexplaining the more generic concepts of the approach).

In FIG. 4, the downward arrow J indicates a dynamic range reduction (ifone were to directly render this image on a display (which is nottypically required to be done so), one would see the more representativepixels of relatively darker and middle ranges coming closer togetherbrightness-wise) by a certain curve, and the upward arrow T indicates adynamic range expansion by the inverse curve. Q represents aquantization step. I.e. while we assume the signals and all processingupon them are defined in floating point (or high-accuracy integers, e.g.12-bit or 16-bit), at position Q in the chain, the number ofrepresentation levels is reduced to e.g. 256 or 1024, such that thesignal may be represented by e.g. 8-bit quantizer indices, which may bestored and/or transmitted and/or encoded over an interface of limitedbit depth/bandwidth. In the following, we will assume all signals andcurves are defined on the normalized float range of 0 . . . 1.

The diagram in FIG. 4 has been simplified in that it shows only a singlesignal path, corresponding to the luminance component. Specifically, thepixel color values may be provided as a luminance component and twochroma components, such as e.g. a Yuv representation. FIG. 4 (as well asFIGS. 1 to 3) illustrates the signal path for the luminance component(i.e. for Y).

In some scenarios where pixel values are provided as color channels,such as e.g. RGB or XYZ color representations, each of the colorchannels could be considered to provide an individual mono-chrome image.In such a consideration, the value of each color channel could beconsidered to correspond to a luminance representation of the associatedmonochrome image. Thus, in practice, the same log curve could beindependently applied to each color component/channel, as shown in FIG.5.

The approach combines several readily available curves into a combinedcurve that has a desired property. The particular property that wedesire is specifically the suitability of the curve for quantizing anHDR signal with the lowest possible perceptual distortion. We establishthe suitability of a curve for this purpose by applying it to severaloriginal (un-quantized floating point) HDR test images (which we haveestablished to be sensitive to quantization artifacts) and visuallyevaluating the artefacts (i.e. differences with the original) in thequantized image (after applying the inverse curve) on a HDR referencedisplay. We found that combining two or three curves as building blocksalready provides quite suitable combined curves.

A generic example of combining, more specifically concatenating, threecurves is shown in FIG. 6 (Example of concatenating three curves tobuild a combined curve as well as the inverse combined curve).

In some embodiments, all curves before quantization could work in thedirection of lowering the dynamic range (output>=input on the normalized0 . . . 1 ranges), indicated by the downward arrows 1, and all curvesafter quantization will increase the dynamic range (output<=input on thenormalized 0 . . . 1 ranges), indicated by the upward arrows T.

However, since readily available building blocks may be applied (one ofwhich may be a variable gamma curve, at least the gamma-power beingoptimized to work with some reference situation), one may also, andadvantageously, apply individual building blocks to work in the oppositedirection (i.e. if the first curve curves too steeply—i.e. it stretchesthe blacks strongly, and then levels off high in the available codes,one may use a second correction block that bends the curve of the finalresult less, so that the blacks are stretched less, which may beadvantageously if we have a movie that e.g. doesn't go so deeply blackanyway), as long as the overall combined curve maintains the desireddownward or upward correction. An example to illustrate this is shown inFIG. 7, where curve (c) works “against” curves (a) and (b), i.e. locallystretches if the other compressed and vice versa.

We will now present various combined curves that have experimentallybeen determined to work well for quantization of an HDR signal displayedon a HDR reference display with a peak brightness of 5000 cd/m² (wherethe 0 . . . 5000 cd/m² range is normalized to the 0 . . . 1 range forapplying the curves). Our reference display EOTF is a gamma of 1.25,which we have found to provide the correct dim-surround rendering intentand it is also the value that occurs in a traditional television chainusing traditional reference displays (Cathode Ray Tubes); see [6]:sections 23.14, 19.13 and 11.9. The EOTF can be considered to be anadditional gamma curve building block (with gamma equal to 1.25) that isconcatenated (only) at the decoder/display side. Most of the curves weremade using sRGB, Rec709, and gamma curve building blocks as these arewidely implemented, but other curves could also be used as a buildingblock. The curves, and therefore the building blocks, exist both in anormal and inverse form, depending on whether they are used on thesource side, before quantization, to convert from a linear, more highlydynamic, representation to a “logarithmic”/compressed more low dynamicrange representation, or on the sink side to convert from the“logarithmic” representation to a more linear representation. The exactdefinition of the curves used as building blocks is given in theAppendix: building block curve definitions.

A first curve, constructed from a gamma and an sRGB building block (andtheir inverse) is shown in FIG. 8. Values of gamma around 2.1(approximately the 2.0 . . . 2.2 range) work well in this chain. One maysee the second curve-part as a pre-correction, or a post-tuning,compared to a reference, e.g. classical situation.

A second two-block curve, constructed from a gamma and Rec.709 buildingblock is shown in FIG. 9.

Finally, we also found experimentally that the PQ, where the ↑PQ isgiven by eq. (7) of [7], can be improved by adding a gamma curvebuilding block.

The PQ function is defined as:Y=L*((V{circumflex over ( )}1/m−c1)/(c2−c3*V{circumflex over( )}1/m){circumflex over ( )}1/n

In which Y is the resultant luma code allocated, V is the input (e.g.camera-captured or master graded for an optimal cinematic look)luminance scaled as a float within 0<=V<=1, L is a constant taken to be10000 nit, m=78.8438, n=0.1593, c1=0.8359, c2=18.8516, c3=18.6875, an{circumflex over ( )} is the power function.

This curve was defined with the pre-assumption one would never need toencode scene luminances above 10000 nit (or at least not render above10000 nit), as one can always process brighter objects like the sun by(soft)-clipping within that range.

We may define as an exemplary embodiment from this a reference rangewhich is defined always to a maximum of 5000 nits (brighter displayswill then just (smartly) boost this encoded value to their peakbrightness of e.g. 7000 nit. The skilled reader of course understandsthat although we teach embodiments with a white reference level of 5000nits, we can similarly apply our teachings into a codec which caters fore.g. a 15000 nit reference luminance range to be standard codeable.

The PQ has been defined on the 0 . . . 10000 cd/m² range, but we e.g.only use the 0 . . . 5000 cd/m² part in our experiments (and normalizedthe input and output ranges for that limited range to 0 . . . 1).

To do this, in the Linear to Log conversion we multiply the 0 . . . 1input range by 10000 (and then using only the 0 . . . 5000 input range)and then normalize the output to the 0 . . . 1 range again by dividingthe output of the doPQ( ) function by doPQ(5000). In the Log to Linearconversion, we need to correspondingly scale the input range first bymultiplying it by doPQ(5000) and then divide the output of doPQinv( ) by5000 to normalize the output range also to 0 . . . 1

/* Linear to Log */ static double doPQ(double Y) { double L = 10000; /*range is 0..10000 nit */ double m = 78.8438; double n = 0.1593; doublec1 = 0.8359; double c2 = 18.8516; double c3 = 18.6875; double V,yln; yln= pow(Y*(1/L),n); V = pow((c2*yln + c1)/(c3*yln + 1),m); return V; } /*Log to Linear */ static double doPQinv(double V) { double L = 10000; /*range is 0..10000 nit */ double m = 78.8438; double n = 0.1593; doublec1 = 0.8359; double c2 = 18.8516; double c3 = 18.6875; double Y,v1m; if(V>0) { v1m = pow(V, 1/m); Y = L * pow((v1m − c1)/(c2 − c3*v1m),1/n); }else { Y=0; } return Y; }

The best performing gamma value we found is around 1.25, as shown inFIG. 10. The PQ building blocks in FIG. 10 are the curves that operateon the 0 . . . 5000 cd/m² range, as mentioned above.

While the previously presented curves were combinations of two buildingblocks, we found generally better curves, i.e. curves with smallerperceivable quantization artefacts, using combinations of three buildingblocks. For example, FIG. 11 shows a curve constructed from two sRGBbuilding blocks and a gamma block. FIG. 12 shows a similar design usingtwo Rec.709 building blocks and a gamma block.

To provide a quick overview and comparison of the presented curves, theyhave been plotted together in FIG. 13. The horizontal axis representsthe logarithmic/LDR domain, normalized to the 0 . . . 1 range. Thevertical axis represents the linear/HDR domain, normalized to the range0 . . . 1, where the value of 1 corresponds to a peak brightness of 5000cd/m² in this case. For clearer visibility of the smaller linear values,the log 2( ) of the value is plotted instead of the actual value.

Other examples of suitable curves are illustrated in FIGS. 14-16. In theexamples, the mappings are demonstrated with references to the codemapping functions, i.e. the mapping of luma codes to linear luminancevalues is shown.

These examples are based on a partial function referred to as LC (a)which is given as:

$x = \frac{10^{\frac{v - d}{c}} - b}{a}$where x is the output value, normalized to the 0 . . . 1 range and v isthe input value, normalized to the 0 . . . 1 range. The values a, b, cand d are design parameters that may be selected to provide the desiredmapping.

What is transmitted or stored as a video signal may have the used codeallocation defined in e.g. the following ways: two gamma functions perse(but one could also, with typically the reference/standard functionbeing allocated only a type-indicator such as 1=sRGB, 2=709, etc., andthen we encode only the differential/second block gamma function, i.e.typically only at least a gamma power and perhaps offset, and gain), butone could also encode (e.g. as a function, LUT, or approximative finalgamma function with a resultant gamma [not necessarily the product ofthe two gammas, because of the dark offset] and offset and gain, whichlargely follows our proposed dual-block curve), a total code allocationfunction (being the successive application of all partial blocks).

The skilled person understands that combinations of what we teach canexist, and where what we have said in one paragraph is also relevant toother embodiments. None of the mere examples are supposed to belimitative, nor is particular wording if not clearly intended to belimitative. All methods functions can be similarly realized as apparatusconstructions, and vice versa.

APPENDIX: BUILDING BLOCK CURVE DEFINITIONS

This appendix describes the individual building blocks in detail bygiving their ANSI C code implementation. All inputs and outputs assume anormalized 0 . . . 1 range.

The sRGB building blocks are derived from the sRGB specification (IEC61966-2-1:1999). The ↓sRGB curve is defined in Table 1 and the inverse↑sRGB curve is defined in Table 2.

The Rec.709 building blocks are derived from Rec. ITU-R BT.709-5. The↓Rec.709 curve is defined in Table 3 and the ↑Rec.709 curve is definedin Table 4.

The gamma building blocks (with parameter γ) are a simple powerfunction, with γ<1 for the downward direction and γ>1 for the upwarddirection. The ↓γ and ↑γ building blocks are thus defined in Table 5.

TABLE 1 Definition of the ↓sRGB curve. static double dosrgb(double L) {double gamma = 1 / 2.4; double V; double gamgain = 1.055;double gamoffset = −0.055; double linlimit = 0.0031308; double lingain =12.92; if (L < linlimit) { V = L * lingain; } else { V = gamgain *pow(L, gamma) + gamoffset; } return V; }

TABLE 2 Definition of the ↑sRGB curve static double dosrgbinv(double L){ double gamma = 2.4; double V; double invgamgain = 1 / 1.055;double invgamoffset = 0.055; double linlimit = 0.0031308 * 12.92;double lingain = 1 / 12.92; if (L < linlimit) { V = L * lingain; } else{ V = pow((L + invgamoffset) * invgamgain, gamma); } return V; }

TABLE 3 Definition of the ↓Rec.709 curve. static double doitu709(doubleL) { double gamma = 0.45; double V; double gamgain = 1.099;double gamoffset = −0.099; double linlimit = 0.018; double lingain =4.5; if (L < linlimit) { V = L * lingain; } else { V = gamgain * pow(L,gamma) + gamoffset; } return V; }

TABLE 4 Definition of the ↑Rec.709 curve. static doubledoitu709inv(double L) { double gamma = 1 / 0.45; double V;double invgamgain = 1 / 1.099; double invgamoffset = 0.099;double linlimit = 4.5 * 0.018; double lingain = 1 / 4.5; if (L <linlimit) { V = L * lingain; } else { V = pow((L + invgamoffset) *invgamgain, gamma); } return V; }

TABLE 5 Definition of the gamma curve. static double dogamma(double L,double gamma) { return pow(L, gamma); }

REFERENCES

-   [1] “Color grading,” Wikipedia, the free encyclopedia, [Online].    Available: http://en.wikipedia.org/wiki/Color_grading. [Accessed 7    Aug. 2012].-   [2] “Post-production,” Wikipedia, the free encyclopedia, [Online].    Available: http://en.wikipedia.org/wiki/Post_production. [Accessed    26 Jun. 2013].-   [3] “High-dynamic-range imaging,” Wikipedia, the free encyclopedia,    [Online]. Available:    http://en.wikipedia.org/wiki/High-dynamic-range_imaging. [Accessed    27 Jun. 2013].-   [4] “sRGB,” Wikipedia, the free encyclopedia, [Online]. Available:    http://en.wikipedia.org/wiki/SRGB. [Accessed 10 Aug. 2012].-   [5] “Rec. 709,” Wikipedia, the free encyclopedia, [Online].    Available: http://en.wikipedia.org/wiki/Rec._709. [Accessed 10 Aug.    2012].-   [6] R. Hunt, The Reproduction of Colour, Sixth ed., Wiley, 2006.-   [7] S. Miller, M. Nezamabadi and S. Daly, “Perceptual Signal Coding    for More Efficient Usage of Bit Codes,” in SMPTE Annual Technical    Conference & Exhibition, Hollywood, Calif., 2012.

The invention claimed is:
 1. A high dynamic range video encodercomprising an apparatus for determining a code allocation functioncomprising: a calculation circuit arranged to determine a first partialfunction of at least two partial functions which defines a non-linearinvertible mapping of an entire luminance range of a linear luminanceinput value to an entire luma range of a first output luma value; acalculation circuit arranged to determine a second partial function tobe consecutively applied to the luma value from the first partialfunction of the at least two partial functions, which second partialfunction defines a non-linear invertible mapping of an entire luma rangeof an input luma value being first output luma value to an entire lumarange of a second output luma value; and a code allocation functionconstruction circuit arranged to construct a code allocation functionfor allocating pixel colors having pixel luminances to luma codesencoding such pixel luminances from the at least two partial functions.2. A high dynamic range video encoder of claim 1 comprising an outputcircuit to output luma code values together with chroma values whichdefine the high dynamic range video, together with data defining atleast one of the at least two partial functions.
 3. A high dynamic rangevideo encoder of claim 1 in which one of the at least two partialfunction circuits is a pre-determined tone mapping function circuit. 4.A high dynamic range video encoder of claim 1 in which one of the atleast two partial functions is: a gamma curve circuit; or a Dolbyperceptual quantizer function circuit; or a function circuit defined as:$Y = {L\left( \frac{V^{\frac{1}{m - {c\; 1}}}}{\left( {{c\; 2} - {c\;{3 \cdot V^{\frac{1}{m}}}}} \right)^{\frac{1}{n}}} \right)}$where Y is a luma value, V is a linear luminance input value in therange of [0;1], L is a constant reflecting a white point, and m, n, c1,c2, and c3 are design parameters; or a function circuit defined as:$x = \frac{10^{\frac{v - d}{c}} - b}{a}$ where x is the output value inthe range of [0;1], v is the input value in the range of [0;1], and thevalues a, b, c and d are design parameters.
 5. An apparatus fordetermining a code mapping function for mapping from luma codes to pixellinear luminances, the apparatus comprising: a first determiner circuitfor determining at least two partial functions for the code mappingfunction; and a second determiner circuit for determining the codemapping function based on the at least two partial functions applied inconsecutive order; wherein the code mapping function circuit provides anon-linear mapping of luma codes to pixel linear luminances which isdefined from the following two partial functions to be applied inconsecutive order: a first partial function circuit of the at least twopartial functions defining a non-linear invertible mapping of an entireluma range of an input luma code to an entire luma range of a lumaoutput value; and a second partial function circuit of the at least twopartial functions defines a non-linear invertible mapping of an entireluma range of a luma input value being the luma output value to anentire luminance range of a pixel linear luminance value.
 6. A highdynamic range video decoder comprising an apparatus of claim
 5. 7. Ahigh dynamic range video decoder comprising an apparatus of claim 5, andan input circuit for receiving an image with pixel colors encoded byluma code values together with chroma values, and data defining at leastone of the at least two partial function circuits.
 8. A high dynamicrange video decoder of claim 5 arranged to apply the code mappingfunction circuit based on the at least two partial function circuits tothe luma code values.
 9. A high dynamic range video decoder of claim 5in which the input circuit is connected to a storage medium, or a videocable or wireless video connection.
 10. A high dynamic range videodecoder of claim 5 in which one of the at least two partial functioncircuits is a pre-determined tone mapping function circuit.
 11. A highdynamic range video decoder of claim 5 in which one of the at least twopartial functions is: a gamma curve circuit; or a Dolby perceptualquantizer function circuit; or a function circuit defined as:$Y = {L\left( \frac{V^{\frac{1}{m - {c\; 1}}}}{\left( {{c\; 2} - {c\;{3 \cdot V^{\frac{1}{m}}}}} \right)^{\frac{1}{n}}} \right)}$where Y is a luma value, V is a linear luminance input value in therange of [0;1], L is a constant reflecting a white point, and m, n, c1,c2, and c3 are design parameters; or a function circuit defined as:$x = \frac{10^{\frac{v - d}{c}} - b}{a}$ where x is the output value inthe range of [0;1], v is the input value in the range of [0;1], and thevalues a, b, c and d are design parameters.